src = """@BindView(R2.id.view_top_divider)
View mViewTopDivider;
@BindView(R2.id.tv_order_number_and_order_buyer_unit)
TextView mTvOrderNumberAndOrderBuyerUnit;
@BindView(R2.id.iv_contact_phone)
ImageView mIvContactPhone;
@BindView(R2.id.tv_contact_name)
TextView mTvContactName;
@BindView(R2.id.tv_order_time)
TextView mTvOrderTime;
@BindView(R2.id.tv_send_time)
TextView mTvSendTime;
@BindView(R2.id.tv_order_price)
TextView mTvOrderPrice;
@BindView(R2.id.tv_order_type)
TextView mTvOrderType;
@BindView(R2.id.tv_order_state)
TextView mTvOrderState;
@BindView(R2.id.iv_sale_phone)
ImageView mIvSalePhone;
@BindView(R2.id.tv_sale_name)
TextView mTvSaleName;
@BindView(R2.id.layout_sale)
RelativeLayout mLayoutSale;
@BindView(R2.id.iv_sign_image)
ImageView mIvSignImage;
@BindView(R2.id.tv_sign_number)
TextView mTvSignNumber;
@BindView(R2.id.layout_sign_image)
RelativeLayout mLayoutSignImage;
@BindView(R2.id.divider_sign_image)
View mDividerSignImage;
@BindView(R2.id.bt_order_detail)
FrameLayout mBtOrderDetail;
@BindView(R2.id.layout_info)
LinearLayout mLayoutInfo;
@BindView(R2.id.view_middle_divider)
View mViewMiddleDivider;
@BindView(R2.id.iv_update_image)
ImageView mIvUpdateImage;
@BindView(R2.id.rv_image)
RecyclerView mRvImage;
@BindView(R2.id.layout_image)
RelativeLayout mLayoutImage;
@BindView(R2.id.view_bottom_divider)
View mViewBottomDivider;
"""


class View:
    id = 0
    typeName = ""
    fieldName = ""

    def toString(self) -> str:
        return "id = %s,typeName = %s, fieldName = %s" % (self.id, self.typeName, self.fieldName)


lines = src.splitlines()

view = View()

li = list()

for i in range(len(lines)):
    line = lines[i]
    if line.startswith("@"):
        view = View()
        li.append(view)
        temp = line.split("(")[1]
        the_id = temp.split(")")[0]
        view.id = the_id.replace("R2", "R")
    elif len(line) == 0:
        pass
    else:
        print(line)
        split = line.split(" ")
        view.typeName = split[0]
        view.fieldName = split[1].split(";")[0]


def printMethod(item: View, viewName: str):
    print("%s = (%s)%s.findViewById(%s);" % (item.fieldName, item.typeName, viewName, item.id))
    pass


def splitLines():
    print("-------\n\n\n")


splitLines()

for item in li:
    printMethod(item, "view")

splitLines()

for item in li:
    print("textViews.add(%s);" % item.fieldName)
